package com.yupi.springbootinit.config;
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 28993
 */

@Configuration
@ConfigurationProperties(prefix = "spring.redis")
public class RedissionConfig {

	private   final Integer database = 1 ;

	private   final String host = "localhost";

	private final Integer port = 6379;
	@Bean
	public RedissonClient redissonClient() {
		Config config = new Config();
		config.useSingleServer()
				.setDatabase(database)
				.setAddress("redis://" + host + ":" + port);
		return Redisson.create(config);
	}
}
